package com.example.publishDemo.Service.Impl;

import com.example.publishDemo.Mapper.AdminMapper;
import com.example.publishDemo.Model.Article;
import com.example.publishDemo.Model.ArticleReport;
import com.example.publishDemo.Model.User;
import com.example.publishDemo.Service.AdminService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {

    @Resource
    AdminMapper adminMapper;

    @Override
    public int totalUser() {
        return adminMapper.totalUser();
    }

    @Override
    public int totalArticle() {
        return adminMapper.totalArticle();
    }

    @Override
    public List<Article> articleRange(int start, int end) {
        return adminMapper.articleRange(start,end);
    }

    @Override
    public int delArticleForId(int a_id) {
        return adminMapper.delArticleForId(a_id);
    }

    @Override
    public List<User> UserRange(int start, int end) {
        return adminMapper.UserRange(start,end);
    }

    @Override
    public int delUserForId(int u_id) {
        return adminMapper.delUserForId(u_id);
    }

    @Override
    public int totalReport() {
        return adminMapper.totalReport();
    }

    @Override
    public List<ArticleReport> ReportRange(int start, int end) {
        return adminMapper.ReportRange(start,end);
    }

    @Override
    public User getUserById(int u_id) {
        return adminMapper.getUserById(u_id);
    }

    @Override
    public Article getArticleForId(int a_id) {
        return adminMapper.getArticleForId(a_id);
    }

    @Override
    public int completeProcess(int r_id) {
        return adminMapper.completeProcess(r_id);
    }

    @Override
    public int totalComment() {
        return adminMapper.totalComment();
    }

    @Override
    public int totalView() {
        return adminMapper.totalView();
    }

    @Override
    public List<Integer> getArticleTop5Views() {
        return adminMapper.getArticleTop5Views();
    }

    @Override
    public List<String> getArticleTop5Title() {
        return adminMapper.getArticleTop5Title();
    }

    @Override
    public List<String> getAllTagName() {
        return adminMapper.getAllTagName();
    }

    @Override
    public int findArticleForTagName(String tagName) {
        return adminMapper.findArticleForTagName(tagName);
    }

    @Override
    public boolean isRecommend(int a_id) {
        if (adminMapper.isRecommend(a_id) > 0) {
            return true;
        }
        return false;
    }

    @Override
    public int unRecommend(int a_id) {
        return adminMapper.unRecommend(a_id);
    }

    @Override
    public int Recommend(int a_id) {
        return adminMapper.Recommend(a_id);
    }

    @Override
    public boolean isAdmin(int u_id) {
        if (adminMapper.isAdmin(u_id) > 0) {
            return true;
        }
        return false;
    }

    @Override
    public int unAdmin(int u_id) {
        return adminMapper.unAdmin(u_id);
    }

    @Override
    public int Admin(int u_id) {
        return adminMapper.Admin(u_id);
    }

}
